package com.eco.fanliapp.admin.controller.web;


import com.eco.fanliapp.admin.annotation.SysLogAnnotation;
import com.eco.fanliapp.admin.common.BaseController;
import com.eco.fanliapp.common.response.ServerResponse;
import com.eco.fanliapp.entity.GoodsImageLable;
import com.eco.fanliapp.service.IGoodsImageLableService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

/**
 * <p>
 * 商品图片标签表 前端控制器
 * </p>
 *
 * @author jobob
 * @since 2020-01-09
 */
@RestController
@RequestMapping("/web/imageLable")
public class GoodsImageLableController extends BaseController {
    @Autowired
    private IGoodsImageLableService goodsImageLableService;
    /**
     * 图片添加和修改
     * @param goodsImageLable
     * @return
     */
    @SysLogAnnotation(value = "保存商品图标签",userType = 2)
    @RequestMapping(method = RequestMethod.POST,value = "/save")
    public ServerResponse insertAndUpdate(@RequestBody GoodsImageLable goodsImageLable){
        return goodsImageLableService.insertAndUpdate(goodsImageLable);
    }

    @RequestMapping(method = RequestMethod.GET,value = "/selectGoodsImageLableList")
    @ResponseBody
    public ServerResponse selectGoodsImageLableList(@RequestParam(defaultValue = "1") Integer pageNum, @RequestParam(defaultValue = "10")Integer pageSize){
        return goodsImageLableService.selectGoodsImageLableList(pageNum,pageSize);
    }

    @SysLogAnnotation(value = "删除商品图标签",userType = 2)
    @RequestMapping(method = RequestMethod.GET,value = "/deleteGoodsImageLable")
    @ResponseBody
    public ServerResponse deleteGoodsImageLable(Integer id){
        return goodsImageLableService.deleteGoodsImageLable(id);
    }

}
